package com.company.dao;

import java.util.List;

import com.company.entity.Chanpinfuwu;
import com.company.entity.News;

public class PageNewsDao extends BaseDao<News> {

	int ProNum = 4;

	public int queryPageNum() {
		String sql = "from News";
		int NumOfPro = queryEntiys(sql).size();
		return NumOfPro % ProNum == 0 ? NumOfPro / ProNum : NumOfPro / ProNum
				+ 1;
	}

	public List<News> query(int PageNum) {
		String sql = "from News order by id desc";
		return queryEntiysById(sql, (PageNum - 1) * ProNum);
	}

	public List<News> querylast() {
		String sql = "from News order by id desc";
		return queryEntiysLast(sql, 5);
	}
}
